<?php 
$listDanhMuc=$this->list;
?>
<div class="center_title_bar">Quản lý danh mục</div>
    <div class="prod_box_big">
        <div class="top_prod_box_big"></div>
        <div class="center_prod_box_big">
			<table border="1" id="myTable" style="width: 540px;margin-left: 7px;margin-top: -5px;">
				<thead>
					<tr>
						<td width="30">STT</td>
						<td width="130">Tên danh mục</td>
						<td width="280">Chú thích</td>
						<td>Chức năng</td>
					</tr>
				</thead>
				<tbody>
				<?php 
				$i=0;
					foreach ($listDanhMuc as $value) {
						$i++;
						$classname='tr1';
						if($i%2==0) $classname='tr2';
						$value instanceof Application_Model_bean_DanhMucSanPham;
						?>
						<tr class="<?php echo $classname?>">
						<td align="center"><?php echo $i?></td>
						<td><?php echo $value->getTen()?></td>
						<td><?php echo $value->getChuThich()?></td>
						<td align="center">
						<a href="<?php echo $value->getId()?>" title="header=[Xóa danh mục] body=[&nbsp;] fade=[on]" class="xoaDanhMucBT"><img src="../images/delete.png" alt="" border="0"  /></a>
						<a href="../danh-muc/update?id=<?php echo $value->getId()?>" title="header=[Sữa danh mục] body=[&nbsp;] fade=[on]" class="EditDanhMucBT"><img src="../images/edit.png" alt="" border="0"  /></a>
						</td>
						</tr>
						<?php 
					}
				?>
				</tbody>
			</table>
        </div>
        <div class="bottom_prod_box_big"></div>
      </div>
<script>
	window.addEvent('domready', function(){
		$$('.xoaDanhMucBT').addEvent('click', function(e){
			var a=confirm('Bạn có chắc xóa không?');
			if(a==false) return false;
			new Event(e).stop();
			var idDM=this.get('href');
			var log=$('logRespont');
			var urlXoaDanhMuc=rootURL+'/danh-muc/delete';
			var data={id: idDM};
			var suceessFF=function(){
				//load lai quan ly danh muc
				var urlload=rootURL+'/danh-muc/quanlydanhmuc?mess=hi';
				var logit=$('logContent');
				requestAdv3(urlload,logit);
				};
			requestAdv2(urlXoaDanhMuc,log,data,suceessFF);
			});
		});
</script>